import { Injectable, Inject } from '@nestjs/common';
import { GetRequestParamsService } from './modules/get-request-params/get-request-params.service';
import { RedisClientType } from 'redis';
import { I18nContext, I18nService } from 'nestjs-i18n';

@Injectable()
export class AppService {
  @Inject(GetRequestParamsService)
  private requestMethodService: GetRequestParamsService;

  @Inject('REDIS_CLIENT')
  private redisClient: RedisClientType;

  @Inject()
  i18n: I18nService;

  getHello(): string {
    return this.i18n.t('test.hello', { lang: I18nContext.current().lang });
  }

  test(): string {
    return this.requestMethodService.test();
  }

  async operateRedis() {
    const value = await this.redisClient.keys('*');
    console.log(value);

    return 'Hello World!';
  }
}
